package com.example.xd.tuiliu_test.rtp;

import android.util.Log;

import com.example.xd.tuiliu_test.rtp.android.screenrecorder.rtp.RtpSocket;
import com.example.xd.tuiliu_test.rtp.android.screenrecorder.rtp.RtpUdp;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Arrays;

/**
 * @auther XuDan on 2020/5/8.
 */
public class RTPClient {
    public static void main(String[] args) {
        test("你好,我是RTPClient".getBytes());
    }

    public static void test(byte[] data) {
        boolean is = true;
        if (is) {
            System.out.println("------发送----------------");
            byte[] bytes = Arrays.copyOf(data, 1024);
            try {
                DatagramSocket datagramSocket = new DatagramSocket(2345);
                InetAddress localHost = InetAddress.getLocalHost();
                DatagramPacket datagramPacket = new DatagramPacket(bytes, bytes.length, localHost, 5432);
                datagramSocket.send(datagramPacket);
                datagramSocket.close();
                is = false;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
